<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <title>编辑服务</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">

        <link rel="stylesheet" href="../plugins/layui/css/layui.css" media="all" />
        <link rel="stylesheet" href="../css/global.css" media="all">        
    </head>

    <body>
        <div style="margin: 15px;">			
            <fieldset class="layui-elem-field">
                <legend>服务详情</legend>
                <div class="layui-field-box">
                    <form class="layui-form" action="">	
                        <table class="layui-table">
                            <tr><th>事项名称：</th><td>房屋结构安全审批</td></tr>
                            <tr><th>事项编号：</th><td>001005030</td></tr>                        
                            <tr><th>服务主题：</th><td>建筑类</td></tr>
                            <tr><th>订单步骤：</th><td>订单步骤一</td></tr>
                            <tr><th>产品编号：</th>
                                <td>                               
                                    <div class="layui-input-inline">
                                        <input type="text" name="number" lay-verify="number" autocomplete="off" placeholder="请输入产品编号" class="layui-input">
                                    </div>
                                </td></tr>
                            <tr><th class="detail-title">办理须知：</th>
                                <td>                               
                                    <div class="layui-input-block edit_box">
                                        <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>
                                    </div>
                                </td>
                            </tr>											
                        </table>                       
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="demo1">保存</button>
                            <button class="layui-btn layui-btn-primary" lay-submit="" lay-filter="demo2">上线</button>
                        </div>                       
                    </form>

                </div>
            </fieldset>	
        </div>
        <script type="text/javascript" src="../plugins/layui/layui.js"></script>
        <script>
            layui.use(['form', 'layedit', 'laydate'], function () {
                var form = layui.form(),
                        layer = layui.layer,
                        layedit = layui.layedit,
                        laydate = layui.laydate;

                //创建一个编辑器
                var editIndex = layedit.build('LAY_demo_editor');
                //自定义验证规则
                form.verify({
                    number: function (value) {
                        if (value.length < 5) {
                            return '产品编号不能为空且不小于5';
                        }
                    },
                    content: function (value) {
                        layedit.sync(editIndex);
                    }
                });

                //监听提交
                form.on('submit(demo1)', function (data) {
                    layer.alert('提交的数据：' + JSON.stringify(data.field), {icon: 1,title:'提交信息'},function(){
                        location.href = "../businessSystem/serviceProject.html";
                    });
                    return false;
                });
                form.on('submit(demo2)', function (data) {
                    layer.alert('上线成功!', {icon: 1,title:'上线信息'},function(){
                        location.href = "../businessSystem/serviceProject.html";
                    });
                    return false;
                });
            });
        </script>
    </body>
</html>